<template>
  <div>
    <div class="incolumn_countr">
      <div class="search-box">
        <hy-search
          ref="query"
          :searchTitle="searchTitle"
          v-model="searcher"
          :button="{btnShowBy3:true}"
          :buttonText="{btnNameBy3:'新增车辆'}"
          :col="6"
          @search="getlist(0)"
          @clickbybtn3="jump"
        ></hy-search>
      </div>
    </div>
    <div class="Table_Box">
      <el-table
        :data="tableData"
        style="width:99%;background-color:#fff"
        :height="620"
        :max-height="620"
        stripe
      >
        <el-table-column label="序号" type="index" align="center" width="100"></el-table-column>
        <el-table-column prop="carNumber" label="车牌号" align="center"></el-table-column>
        <el-table-column prop="carBrand" label="品牌" align="center"></el-table-column>
        <el-table-column prop="carType" label="型号" align="center"></el-table-column>
        <el-table-column prop="carColor" label="颜色" align="center"></el-table-column>
        <el-table-column prop="state" label="状态" align="center"></el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <!-- <el-button
              size="small"
              type="warning"
              @click="Details(scope.row.id,0)"
              v-if="scope.row.paixu==2"
            >归还</el-button>-->
            <el-button
              size="small"
              type="warning"
              @click="Details(scope.row.id,0)"
              v-if="scope.row.paixu>0"
            >审核</el-button>
            <el-button size="small" type="primary" @click="Details(scope.row.id,1)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- ================================================ -->
    <!-- ==========  分页 ========== -->
    <!-- ================================================ -->
    <div class="Bottom_FenYe">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
    <!-- ======================================================= -->
    <!-- =============== 添加车辆 ================ -->
    <!-- ======================================================= -->
    <el-dialog :visible.sync="dialogVisible" :modal-append-to-body="false" width="1200px">
      <div class="Tiao_z">
        <div class="herd_bud"></div>
        <div class="from_cg">添加车辆</div>
      </div>
      <br />
      <div>
        <el-form :model="formInlineBa" :inline="true" class="demo-form-inline" label-width="120px">
          <el-form-item class="demonstration" label="车牌号">
            <el-input v-model="formInlineBa"></el-input>
          </el-form-item>
          <el-form-item class="demonstration" label="品牌">
            <el-input v-model="formInlineBa"></el-input>
          </el-form-item>
          <el-form-item class="demonstration" label="颜色">
            <el-input v-model="formInlineBa"></el-input>
          </el-form-item>
          <el-form-item class="demonstration" label="型号">
            <el-input v-model="formInlineBa"></el-input>
          </el-form-item>
          <el-form-item class="demonstration" label="保质日期">
            <el-date-picker v-model="formInlineBa.b"></el-date-picker>
          </el-form-item>
          <el-form-item class="demonstration" label="年检日期">
            <el-date-picker v-model="formInlineBa.n"></el-date-picker>
          </el-form-item>
        </el-form>
      </div>
      <div class="Form_Btn">
        <el-button type="primary" @click="addlist()">确认</el-button>
        <el-button type="info" @click="dialogVisible = false">返回</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data () {
    return {
      searchTitle: [
        {
          type: "input",
          name: "customProductName",
          label: "输入搜索",
          placeholder: "请输入用品名称",
          prop: "customProductName"
        },
        {
          type: "date2",
          name: "issuanceDate",
          label: "输入时间",
          placeholder: "请选择输入时间",
          prop: "issuanceDate"
        }
      ],
      searcher: {
        customProductName: "",
        customProductNo: "",
        issuanceDate: ""
      },
      formInline: {},
      formInlineBa: {},
      dialogVisible: false,
      total: 1,
      current: 1,
      pagesize: 10,
      tableData: [],
    };
  },
  created () {
    this.getlist(0);
  },
  methods: {
    getlist (page) {
      let start = ""; let end = "";
      if (this.searcher.issuanceDate != null && this.searcher.issuanceDate != "") { start = this.searcher.issuanceDate[0]; end = this.searcher.issuanceDate[1]; }
      let obj = {
        key: this.searcher.customProductName ? this.searcher.customProductName : "",
        start: start,
        end: end,
        pn: page,
        PerPageSize: this.pagesize
      };
      var objs = JSON.stringify(obj);
      let the = { index: 7, jsondata: objs }
      axios.post("/apis/AdministrationManage.asmx/GetData", the).then(({ data }) => {
        var list = eval('(' + data.d + ')');
        this.total = list.count;
        this.tableData = list.data;
      });
    },
    // 分页
    handleCurrentChange (e) {
      this.getlist(e - 1);
    },
    //添加车辆
    jump () {
      // this.dialogVisible = true;
      this.$router.push({ path: "/VehicleManagementAdd" });
    },
    //审核
    Details (e, shows) {
      this.$router.push({ path: "./VehicleManagementcarxiangq", query: { e: e, shows: shows } });
    },
  }
};
</script>
<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
@import '@/assets/scss/search.scss';
.incolumn_countr {
  width: 97%;
}
.block {
  margin-left: 20px;
  cursor: pointer;
}
.diacontent-box {
  width: 100%;
  height: 285px;
  border-top: 1px solid $bordercolor;
  border-bottom: 1px solid $bordercolor;
}
.ebtn {
  float: right;
  margin-right: 20px;
}
.Table_Box {
  margin-left: 13px;
}
.Bottom_FenYe {
  height: 40px;
  text-align: center;
}
//弹窗
.Tiao_z {
  margin-top: -30px;
}
.herd_bud {
  margin-top: -40px;
  height: 20px;
  width: 5px;
  background-color: blue;
}
.from_cg {
  font-size: $font-size-medium-x;
  font-weight: bold;
  margin-top: -20px;
  margin-left: 10px;
}
//按钮
.Form_Btn {
  margin-top: 30px;
  text-align: center;
}
</style>